<template>
	<view class="top">

		<uni-card style="border-radius: 10px;margin-top:0px;">
			<view class="tit">
				<view style="font-size: 16px;
		font-weight: bold;">订单信息</view>
				<view style="color:#FF6532 ;">已完成</view>
			</view>
			<u-divider text=""></u-divider>
			<view>
				<view>订单编号：{{orderReview.cheOrder.number}}</view>
				<view>服务项目：{{serviceDetails.name}}</view>
				<view>服务门店：{{orderReview.cheOrder.cheShop.name}}
					<image style="height: 12px;width: 12px;" src="../../../static/images/ly/plane.png">
					</image>
				</view>
				<view>下单时间：{{orderReview.cheOrder.createTime}}</view>
				<view>预约时间：{{orderReview.cheOrder.subscribeTime}}</view>
				<view>车辆：{{orderReview.cheOrder.cheCar.carNumber}}</view>
				<view>备注：{{orderReview.cheOrder.remark}}</view>
			</view>
			<view style="font-size: 16px;
			font-weight: bold;margin-top: 20px;">订单详情</view>
			<u-divider text=""></u-divider>
			<view>
				<view v-for="(item,index) in orderReview.cheOrder.cheService.serviceItems" :key="index">
					<view class="tit"><text>{{item.name}}</text><text>￥{{item.money}}</text></view>
				</view>

				<u-divider text=""></u-divider>
				<view class="tit"><text>原价</text><text>{{orderReview.cheOrder.cheService.oldPrice}}</text></view>
				<view class="tit"><text>店家优惠</text><text style="color: #FF6532;">-￥{{sjyh}}</text></view>
				<view class="tit"><text>优惠券</text><text style="color: #FF6532;">-￥10</text></view>
				<u-divider text=""></u-divider>
				<view class="tit"><text>支付金额</text><text
						style="font-weight: bold;font-size: 15px;">￥{{orderReview.cheOrder.realPrice}}</text></view>
			</view>
		</uni-card>

		<uni-card style="border-radius: 10px;height: 150px;">
			<view style="font-size: 16px;
			font-weight: bold;">评价结果</view>
			<u-divider text=""></u-divider>
			<view>
				<view>评价时间：{{orderReview.commentTime}}</view>
				<view style="display: flex;">评价结果：<uni-rate size="18" :value="orderReview.star" /></view>
				<view>评语：{{orderReview.comments}}</view>
			</view>
		</uni-card>



	</view>
</template>

<script>
	export default {
		data() {
			return {
				sjyh: '',
				id: '',
				orderReview: [],
				serviceId: '',
				serviceDetails: {}

			}
		},
		onLoad: function(opt) {
			this.id = opt.id;
			// console.log(this.id)
			this.getpjDetails();
		},
		methods: {
			getpjDetails() {
				let that = this;
				this.$http({
					url: `/api/orders/orders/${that.id}`,
					method: 'GET',
					success(res) {
						// console.log(res)
						that.orderReview = res.data.data
						console.log(that.orderReview)
						that.serviceId = res.data.data.cheOrder.serviceId
						console.log(that.serviceId)
						that.getServiceDetails();
					}
				})
				// that.getServiceDetails();
			},
			getServiceDetails() {
				let that = this;
				this.$http({
					url: `/api/service/service/${that.serviceId}`,
					method: 'GET',
					success(res) {
						that.serviceDetails = res.data.data
						that.sjyh = res.data.data.oldPrice - res.data.data.newPrice
						console.log(res)
					}
				})
			},
		}
	}
</script>

<style>
	.top {
		height: 150px;
		background-image: url(../../../static/images/ly/组 6.png);

	}

	.button {
		height: 22px;
		width: 100px;
		font-size: 12px;
		background-color: #3486FD;
		border-radius: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
		color: white;
	}

	.tit {
		display: flex;
		justify-content: space-between;
	}
</style>